<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<link href="<%= request.getContextPath() %>/css/jquery-ui.css" rel="stylesheet" type="text/css"/>
<link href="<%= request.getContextPath() %>/css/profile.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/ui.datepicker-vi.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/jquery.validate.min.js"></script> 
<script>
	$(document).ready(function() {
	 	$("#selectedDate").datepicker();
	 	
	 	if ($("#selectedDate").val() == "") {
		 	var myDate = new Date();
		 	var prettyDate = myDate.getDate() + '/' + (myDate.getMonth()+1) + '/' +
		 	        myDate.getFullYear();
		 	$("#selectedDate").val(prettyDate);
	 	}
	 	
	 	$("#export").click(function() {
	 		$(this).attr("href", $(this).attr("href") + "?selectedRoom=" + $("#selectedRoom").val() + "&selectedDate=" + $("#selectedDate").val());
	 	});
  	});
</script>

<div class="content">		

<div class="left menu">
<jsp:include page="include/profile-menu.jsp"></jsp:include>
</div>
<div class="left divider">
</div>
<div class="left admin-main">
<ul>
<s:if test="%{isSetupRoom == 'false'}">
	<li class="error">
	Bạn chưa cài đặt thông tin phòng khám, vui lòng <a href="/home/profile-room">bấm vào đây</a> để cài đặt
	</li>
</s:if>
</ul>
<div class="left table">
<div><form action="/home/profile" method="post">
	Phòng khám:
	<s:select list="rooms" name="selectedRoom" id="selectedRoom" listKey="roomId" listValue="name"></s:select>
	Ngày: <s:textfield id="selectedDate" name="selectedDate" readonly="readonly" cssClass="datePicker" size="10" />
	<input type="submit" value="Xem lịch hẹn" />
	</form>
</div>
<div>Số cuộc hẹn: <s:property value="numberOfBooking"/></div>
<table border="0">
	<tr>
		<th>Ngày giờ hẹn</th>
		<th>Tên bệnh nhân</th>
		<th>Tuổi</th>
		<th>Mobile</th>
		<th>Tái khám</th>
		<th>Địa chỉ</th>
		<th>Triệu chứng</th>
	</tr>
	<s:iterator value="bookings" status="booking" id="bookingList">
		<tr>
			<td><s:date name="bookingDate" format="dd/MM/yyyy - HH:mm" /></td>
			<td><s:property value="name" /></td>
			<td><s:property value="age" /></td>
			<td><a href="javascript:void(0);" title="<s:property value="phone" />">...</a></td>
			<s:if test="%{recheck == true}">
				<td><img src="<%=request.getContextPath() %>/images/checked.jpg" /></td>
			</s:if>
			<s:else>
				<td>&nbsp;</td>
			</s:else>
			<td><a href="javascript:void(0);" title="<s:property value="address" />">...</a></td>
			<td><s:property value="description" /></td>
		</tr>
	</s:iterator>
</table>
<br/>
<s:if test="%{bookings.size > 0}">
<div><a id="export" class="button" href="/home/export-bookings">Xuất ra file excel</a></div>
</s:if>
</div>
</div>
</div>